package com.mxpio.erp.mes.listener;

import com.mxpio.erp.common.mes.entity.MesScanLog;
import com.mxpio.erp.common.mes.service.MesScanLogService;
import com.mxpio.erp.mes.event.ScanAfterSaveLogEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

@Component
public class ScanAfterSaveLogListener implements ApplicationListener<ScanAfterSaveLogEvent> {
    @Autowired
    MesScanLogService logService;

    @Override
    @Async
    public void onApplicationEvent(ScanAfterSaveLogEvent event) {
        MesScanLog mesSmScanLog = (MesScanLog)event.getSource();
        logService.save(mesSmScanLog);
    }
}
